package com.learning;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.SortedSet;
import java.util.TreeMap;
import java.util.TreeSet;

/**
 * 
 * @author DuyAn
 * 
 */
public class Main {
	/**
	 * colection sort
	 * 
	 * @param args
	 */
	public static void main(String[] args) {
		ArrayList<Integer> arrayList = new ArrayList<>();
		arrayList.add(10);
		arrayList.add(11);
		arrayList.add(3);
		arrayList.add(5);
		Comparator<Integer> comparator = new Comparator<Integer>() {

			@Override
			public int compare(Integer o1, Integer o2) {

				if (o1 > o2)
					return 1;
				else
					return -1;
			}
		};
		Collections.sort(arrayList, comparator);
		for (Integer a : arrayList)
			System.out.println(a);
		 TreeMap<String, Integer> students = new TreeMap<String, Integer>();
	        //Add Key/Value pairs
	        students.put("Ed", 47);
	        students.put("Alan", 34);
	        students.put("Sheila", 65);
	        students.put("Becca", 44);
	 
	        //Iterate over HashMap
	        for(String key: students.keySet()){
	            System.out.println(key  +" :: "+ students.get(key));
	        }
	        TreeSet<Integer> treeSet= new TreeSet<>();
	       

	}

}
